package com.study.service;

import com.study.dao.UserDAO;
import com.study.entity.User;
import org.springframework.transaction.annotation.Transactional;

/**
 * @Author chenyeqing
 * @Date 2021/10/24 20:55
 */

public class UserServiceImpl implements UserService {
    private UserDAO userDAO;

    public void setUserDAO(UserDAO userDAO) {
        this.userDAO = userDAO;
    }

    @Override
    // @Transactional(noRollbackFor = NullPointerException.class)
    public boolean register(User user) {
        boolean save = userDAO.save(user);
        User user2 = null;
        user2.getName();

        return save;
    }

    @Override
    // @Transactional(propagation = Propagation.SUPPORTS ,readOnly = true)
    public void login(String name, String password) {
        userDAO.login(name, password);
    }
}
